﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PatternPrototype
{
    class Program
    {
        static void Main(string[] args)
        {

            Plane plane = new Plane();
            Console.WriteLine(plane.GetPlaneName()+"\n"+plane.GetPlaneType());


            Plane plane2 = new Plane(plane);
            Console.WriteLine(plane2.GetPlaneName() + "\n" + plane2.GetPlaneType());

            Console.ReadKey();
        }
    }


    interface IPrototype<T>
    {
        T Clone();
    }


    class Plane : IPrototype<Plane>
    {
        string name;
        string type;
        public Plane()
        {
            Random ran = new Random();
            this.name = ran.Next(0, 999).ToString();
            this.type = ran.Next(0, 999).ToString();
        }
        public Plane(Plane _plane)
        {
            Random ran = new Random();
            this.name = _plane.name;
            this.type = _plane.type;
        }

        public string GetPlaneName()
        { return name; }
        public string GetPlaneType()
        { return type; }
          
        public Plane Clone()
        {
            return new Plane(this);
        }
    }
}
